﻿using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.DependencyInjection;
using CommunityToolkit.Mvvm.Input;
using CommunityToolkit.Mvvm.Messaging;
using CommunityToolkit.Mvvm.Messaging.Messages;
using Daq.Devices;
using Daq.Services;
using Daq.Utils;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
using Telerik.Windows.Controls;

namespace Daq.ViewModels
{
    public partial class DaqViewModel : ObservableObject
    {
        private readonly SettingsService settings;
        public DaqViewModel(SettingsService settings, DeviceService deviceService)
        {
            this.settings = settings;
            DeviceService = deviceService;
            Daq = DeviceService.Daq;
        }

        [ObservableProperty]
        private DaqBase? daq;// = App.Current.Services.GetService<DeviceService>().Daq;

        [ObservableProperty]
        private DeviceService deviceService;// = App.Current.Services.GetService<DeviceService>();

        [RelayCommand]
        private async Task PageChanged(object obj)
        {
            //if (obj is RadRibbonTab tab)
            //{
            //    if(tab.Header == null) { return; }
            //    string? header = tab.Header.ToString();
            //    if (header == "数据")
            //    {
            //        var vm = App.Current.Services.GetService<DataManagerViewModel>();
            //        if(vm == null) 
            //        {
            //            return; 
            //        }
            //        await vm.RefreshBlackoutDatesAysnc();
            //    }
            //}
        }

    }
}
